package com.wordplat.quickstart.wight.navigation;

import java.util.ArrayList;
import java.util.List;

/**
 * Notification
 *
 * @since 2021-05-08
 */
public class Notification {
    private String text;

    private int textColor;

    private int backgroundColor;

    /**
     * Notification
     */
    public Notification() {
    }

    /**
     * isEmpty
     *
     * @return boolean
     */
    public boolean isEmpty() {
        return text == null || text.length() == 0;
    }

    public String getText() {
        return text;
    }

    public int getTextColor() {
        return textColor;
    }

    public int getBackgroundColor() {
        return backgroundColor;
    }

    /**
     * justText
     *
     * @param text
     * @return Notification
     */
    public static Notification justText(String text) {
        return new Builder().setText(text).build();
    }

    /**
     * generateEmptyList
     *
     * @param size
     * @return List
     */
    public static List<Notification> generateEmptyList(int size) {
        List<Notification> notificationList = new ArrayList<>();
        for (int i = 0; i < size; i++) {
            notificationList.add(new Notification());
        }
        return notificationList;
    }

    public static class Builder {
        private String text;
        private int textColor;
        private int backgroundColor;

        /**
         * setText
         *
         * @param text
         * @return Builder
         */
        public Builder setText(String text) {
            this.text = text;
            return this;
        }

        /**
         * setTextColor
         *
         * @param textColor
         * @return Builder
         */
        public Builder setTextColor(int textColor) {
            this.textColor = textColor;
            return this;
        }

        /**
         * setBackgroundColor
         *
         * @param backgroundColor
         * @return Builder
         */
        public Builder setBackgroundColor(int backgroundColor) {
            this.backgroundColor = backgroundColor;
            return this;
        }

        /**
         * build
         *
         * @return Notification
         */
        public Notification build() {
            Notification notification = new Notification();
            notification.text = text;
            notification.textColor = textColor;
            notification.backgroundColor = backgroundColor;
            return notification;
        }
    }
}
